package com.woniuxy.cloud.batteryassembly.esrepo;

import com.woniuxy.cloud.batteryassembly.model.Battery;
import org.springframework.data.elasticsearch.annotations.Query;
import org.springframework.data.elasticsearch.repository.ElasticsearchRepository;

import java.util.List;

/**
 * @author 高瑞
 * @date 2022/2/22 002214:26
 */
public interface BatteryRepo extends ElasticsearchRepository<Battery,Integer> {


    @Query("{\n" +
            "        \"multi_match\":{\n" +
            "            \"query\":\"?0\",\n" +
            "            \"fields\":[\"typeName\",\"batteryCode\"]\n" +
            "        }\n" +
            "    }")
    List<Battery> search(String keyword);
}
